<?php
namespace common\models;

/**
 * 添加到Solr中的商品信息
 *
 * @author huipeng.teng@liketry.com
 */
class SolrGoods extends \yii\db\ActiveRecord {

    public static function tableName() {
        return 'd_try.solr_goods';
    }

    public static function getDb() {
        return \Yii::$app->db;
    }

    /**
     * 通过商品ID获取信息
     * @param int $goods_id 商品ID
     * @return array 商品信息
     */
    public static function findByGoodsId($goods_id) {
        $var = self::find()->where('goods_id=:goods_id', [':goods_id' => $goods_id])->one();
        return \yii\helpers\ArrayHelper::toArray($var);
    }
}